define(function(require, exports, module) {

  var Backbone = require('backbone');
  var $ = require('jquery');
  var _ = require('underscore');
  var jsonview = require('jsonview');
  var tmpl = require('text!../tmpl.html');
  var html2canvas = require('html2canvas')

  function main() {
    var $app = $('<div id="app">');
    $('#main').html($app);

    $app.append(tmpl);

    $('#screenshot').on('click', function() {
      screenshot()
    })
  }

  function screenshot() {
    html2canvas(document.querySelector("#capture")).then(canvas => {
      document.body.appendChild(canvas)
    });
  }

  return main;
})
